import request from "@/utils/request";
import { AxiosPromise } from "axios";
import { type ICompany } from "./types";
/**
 * 获取企业分页数据
 *
 * @param queryParams
 */
export function getCompanyList(
  queryParams?: QueryParams
): AxiosPromise<ListResult<ICompany>> {
  return request({
    url: "/api/company/index",
    method: "get",
    params: queryParams,
  });
}

/**
 * 新增企业
 *
 * @param data
 */
export function addCompany(data: ICompany): AxiosPromise<DelResult> {
  return request({
    url: "/api/company/add",
    method: "post",
    data: data,
  });
}

/**
 * 编辑企业
 *
 * @param data
 */
export function editCompany(
  id: string | number,
  data: any
): AxiosPromise<DelResult> {
  return request({
    url: `/api/company/edit/id/${id}`,
    method: "post",
    data: data,
  });
}

/**
 * 删除企业
 *
 * @param data
 */
export function deleteCompany(
  ids: string | number,
  data: any
): AxiosPromise<DelResult> {
  return request({
    url: `/api/company/del/ids/${ids}`,
    method: "post",
    data: data,
  });
}
